<?php ob_start();
	include("mysql.php");
        header("Content-Type:text/html;charset=utf8"); 
	header("Access-Control-Allow-Origin: *"); //解决跨域
	header('Access-Control-Allow-Methods:POST');// 响应类型  
	header('Access-Control-Allow-Headers:*'); // 响应头设置 
    
    $opid=$_POST['openid'];
    $appid = $_POST['appid'];
    $sessionKey = $_POST['session_key'];
    $encryptedData = $_POST['data'];
    $iv = $_POST['iv'];
    
	include_once "wxBizDataCrypt.php";
	$data = '';
	$pc = new WXBizDataCrypt($appid, $sessionKey);
	$errCode = $pc->decryptData($encryptedData, $iv, $data );
    
	if ($errCode == 0) {
		//print($data . "\n");
		$hahaha=json_decode($data);
		echo($pho_num=$hahaha->phoneNumber);
		//echo($opid);
		$sql=mysql_query("UPDATE user SET pho_num = '$pho_num' WHERE opid = '$opid'");
	} else {
		print($errCode . "\n");
	}

	
?>